/*
2021-8-15
https://www.acwing.com/problem/content/1114/
*/ 
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
const int N=105;
char g[N][N];
bool st[N][N];
int xa,ya,xb,yb;
int n;
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

bool dfs(int x,int y)
{
    if(g[x][y]=='#') return false;
    if(x==xb&&y==yb) return true;
    st[x][y]=true;
    
    for(int i=0;i<4;i++)
    {
        int a=x+dx[i],b=y+dy[i];
        if(a<0 || a>=n || b<0 || b>=n) continue;
        if(st[a][b]) continue;
        if(dfs(a,b)) return true;
        
    }
    return false;
}

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=0;i<n;i++)
            cin>>g[i];
        cin>>xa>>ya>>xb>>yb;
        memset(st,0,sizeof st);
        if(dfs(xa,ya)) puts("YES");
        else puts("NO");
    }
    return 0;
}
